Add type-safe execute privilege helpers for Custom APIs#17
Merged
Conversation
Introduce a Privilege enum (Create/Read/Write/Delete/Append/AppendTo/ Assign/Share) in the Abstractions package and WithExecutePrivilege<T> overloads on CustomApiConfigBuilder, resolving the platform privilege name from the entity logical name (e.g. prvReadaccount). The existing WithExecutePrivilegeName(string) remains for non-standard names. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>
Introduce a Privilege enum (Create/Read/Write/Delete/Append/AppendTo/ Assign/Share) and WithExecutePrivilege<T> overloads on CustomApiConfigBuilder, resolving the platform privilege name from the entity logical name (e.g. prvReadaccount). The existing WithExecutePrivilegeName(string) remains for non-standard names. The enum lives in the main package rather than Abstractions: it is input-side sugar consumed only at build time and resolved to the ExecutePrivilegeName string, so consumers like XrmSync/XrmMockup never need it. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>
…m/delegateas/XrmPluginCore into execute-privilege-name-helper-bf0 # Conflicts: # XrmPluginCore/CHANGELOG.md
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a type-safe way to configure Custom API ExecutePrivilegeName by introducing a Privilege enum and builder overloads that generate Dataverse privilege names using the prv{Privilege}{EntityLogicalName} convention.
Changes:
- Added
Privilegeenum and a resolver to build standard privilege names (e.g.prvReadaccount). - Added
WithExecutePrivilege<T>(Privilege)andWithExecutePrivilege(string, Privilege)overloads onCustomApiConfigBuilder. - Added unit tests covering privilege name resolution and documented the feature in the changelog.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| XrmPluginCore/Helpers/PrivilegeNameResolver.cs | Adds helper to construct standard execute privilege names from a Privilege + entity logical name. |
| XrmPluginCore/Enums/Privilege.cs | Introduces the Privilege enum representing standard Dataverse table privileges. |
| XrmPluginCore/CustomApis/CustomApiConfigBuilder.cs | Adds type-safe WithExecutePrivilege overloads that set ExecutePrivilegeName via the resolver. |
| XrmPluginCore/CHANGELOG.md | Documents the new builder overloads and their behavior. |
| XrmPluginCore.Tests/CustomApis/CustomApiConfigBuilderTests.cs | Adds coverage for name resolution and builder chaining. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The Privilege enum covers more than CRUD (Append/AppendTo/Assign/Share), so describe the parameter as a "table privilege" rather than a "CRUD privilege" per review feedback. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce a Privilege enum (Create/Read/Write/Delete/Append/AppendTo/ Assign/Share) and WithExecutePrivilege overloads on CustomApiConfigBuilder, resolving the platform privilege name from the entity logical name (e.g. prvReadaccount). The existing WithExecutePrivilegeName(string) remains for non-standard and non-entity-based names.